<template>
  <div>
    <BaseStatus :value-map="{f: 2}" :value="validDate">
      {{ diffDate[0] }}
    </BaseStatus>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue';
import { toolGetDiffDateTime } from '@/utils';
import BaseStatus from '@/components/base-status/index.vue';
defineOptions({ name: 'BaseDateCountdown' });
const props = withDefaults(defineProps<{ value: any }>(), { value: '' });
const diffDate = computed(() => toolGetDiffDateTime(props.value));
/** 计算出是否跟踪到期。小于2天皆赋值红色状态 */
const validDate = computed(() => diffDate.value?.[1] > 2 ? '' : 'f');
</script>
